#
# SearchData.py
#
# This module contains Google Datastore models for simple full-text
# searching on selected eCataloger data model properties.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright 2010- Jeremy Nelson, Alan Cleary, Tomichi Informatics LLC
#

import datetime

from google.appengine.ext import db
from google.appengine.ext import search
from google.appengine.api import users

class EndeavorSearch(search.SearchableModel):
    ''' EndeavorSearch model copies the full-text relevant properties
        from an FRBRData.Endeavor.put() call for full-text searching.'''
    created_on = db.DateTimeProperty(auto_now_add=True)
    created_by = db.UserProperty()
    endeavor = db.ReferenceProperty()
    # Should come from MODSData.note model
    description = db.TextProperty()
    # Should come MODSData.subject.display_form
    subjects = db.StringListProperty(default=None)
    # Should come from MODSData.titleInfo
    title = db.StringProperty()

class QueryLog(db.Model):
    ''' Captures terms used in search, along with any results and date.'''
    search_terms = db.StringProperty()
    timestamp = db.DateTimeProperty(auto_now_add=True)
    results = db.ListProperty(db.Key,
                              default=None)
    

    
    
